package cate.common.table.farm.config.sheet;

import cate.common.table.ESheet;
import cate.common.table.farm.config.row.FbBuyConsumeRow;
import easy.java.dev.note.NoteClass;

@NoteClass(value = "副本购买消耗")
public class FbBuyConsumeSheet extends ESheet<FbBuyConsumeRow> {

    @Override
    public String getSheetName() {
        return "副本购买消耗";
    }

    @Override
    protected FbBuyConsumeRow buildRow() {
        return new FbBuyConsumeRow();
    }

    /**
     * 根据功能id和挑战次数获取购买消耗
     *
     * @param funcId
     * @param use
     * @return
     */
    public FbBuyConsumeRow getConsumeRow(int funcId, int use) {
        int num = use + 1;
        for (FbBuyConsumeRow row : this.getList()) {
            if (row.funcId == funcId && row.start <= num && row.end >= num) {
                return row;
            }
        }
        return null;
    }
}
